FROM phpdockerio/php71-fpm

RUN apt-get update -yqq && \
    apt-get -y install nginx supervisor php7.1-mysql

ADD nginx/default /etc/nginx/sites-available/default
ADD src /var/www
ADD .env.test /var/www/xylife/app-web/.env
ADD .env.test /var/www/xylife/core/.env
ADD oauth/oauth.so /usr/lib/php/20160303/oauth.so
ADD oauth/oauth.ini /etc/php/7.1/mods-available/oauth.ini
ADD start.sh /root/start.sh
RUN chmod a+x /root/start.sh

RUN cd /etc/php/7.1/cli/conf.d && ln -s /etc/php/7.1/mods-available/oauth.ini 20-oauth.ini
RUN cd /etc/php/7.1/fpm/conf.d && ln -s /etc/php/7.1/mods-available/oauth.ini 20-oauth.ini
RUN chown -R www-data:www-data /var/www/xylife/

ENTRYPOINT ["/root/start.sh"]
